package com.sinosoft.sm.system.role.service;

import java.util.List;

import com.sinosoft.sm.system.common.utils.StringUtil;
import com.sinosoft.sm.system.resource.entity.ResourceRoleRefEntity;
import com.sinosoft.sm.system.role.entity.RoleEntity;
import com.sinosoft.sm.system.role.entity.UserRoleRefEntity;
import com.sinosoft.sm.system.role.manager.api.RoleManager;
import com.sinosoft.sm.system.role.service.api.RoleService;

public class RoleServiceImpl implements RoleService {

	private RoleManager roleManager;
	
	public void setRoleManager(RoleManager roleManager) {
		this.roleManager = roleManager;
	}

	@Override
	public List<UserRoleRefEntity> getRolesByUser(String username) {
		if(StringUtil.isBlank(username)){
			return null;
		}
		return roleManager.getRolesByUser(username);
	}

	/**
	 * 获取所有角色信息
	 */
	public List<RoleEntity> getAllRoles() {
		// TODO Auto-generated method stub
		return roleManager.getAllRoels();
	}

	

}
